package com.test.byteDance;

import java.util.Arrays;
import java.util.Scanner;

public class Byte2019_6 {
    int sum = Integer.MAX_VALUE;

    public int coinNum(int price) {
        int money = 1024 - price;
        int[] ints = {64, 16, 4, 1};
        dfs(money, ints, 0, 0);
        return sum;
    }

    public void dfs(int money, int[] ints, int num, int index) {
        if (money == 0) {
            sum = Math.min(sum, num);
            return;
        }
        if (money < 0) {
            return;
        }
        for (int i = index; i < ints.length; i++) {
            if (money - ints[i] < 0) {
                dfs(money, ints, num, i + 1);
            } else {
                dfs(money - ints[i], ints, num + 1, i);
            }
        }
    }

    public int dp(int price) {
        int[] coins = {1, 4, 16, 64};
        int n = 1024 - price;
        int[] f = new int[n + 1];
        Arrays.fill(f, n + 1);
        f[0] = 0;
        for (int i = 1; i <= n; i++) {
            for (int coin : coins) {
                if (i >= coin)
                    f[i] = Math.min(f[i], f[i - coin] + 1);
                else
                    break;
            }
        }
        return f[n];
    }

}

class Main_2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Byte2019_6 byte2019_6 = new Byte2019_6();
        int coin = scanner.nextInt();
        System.out.println(byte2019_6.coinNum(coin));
        System.out.println(byte2019_6.dp(coin));
    }
}
